<!DOCTYPE html>
<html>
<head lang="en">
    <!--<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>-->
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
    <meta charset="UTF-8">
    <title>积分详情页</title>
    <link rel="stylesheet" href="../css/index2.css"/>
    <style>
        body{
            background:#F6F6F6;
            overflow-y: hidden;
        }
        #body{
            /*padding:15px;*/
            /*padding:2.5%;*/
            background:#F6F6F6;
            border-top:1px solid transparent;
        }
        .moneylist:after{
            display:inline-block;
            width: 100%;
            position: relative;
            content:"clear";
            height:0;
            clear:both;
            overflow:hidden;
            visibility:hidden;
        }
        .moneylist{
            /*text-align: justify;*/
        }
        .moneylist div{
            width:30%;
            margin-left:2.5%;
            height:65px;
            /*line-height: 65px;*/
            text-align: center;
            border:1px solid #C0C0C0;
            /*display: inline-block;*/
            float:left;
            margin-top:15px;
            padding-top:10px;
            box-sizing: border-box;
            background: #fff;
        }
        .moneylist div:last-child{
            padding-top:0;
            line-height: 65px;;
        }
        .moneylist div p{
            width:100%;
            text-align: center;
        }
        .moneylist div p:first-child{
            font-size: 18px;
        }
        .moneylist div p:last-child{
            font-size: 12px;
        }
        .moneylist div.checked{
            border:1px solid #D4555F;
        }
        .paybtn{
            margin-left:2.5%;
            width:95%;
            height:50px;
            line-height: 50px;
            text-align: center;
            color:#fff;
            font-size: 19px;
            background: #CC3642;
            border: 1px solid #C82532;
            box-sizing: border-box;
            border-radius: 2px;
        }
        .title{
            font-size: 20px;
            margin:0 2.5%;
            margin-top:15px;
        }
    </style>
</head>
<body class=" experiment-lookup_bar-on gating-feed_switcher_bar-on mweb  gating-new_mweb_header_logged_out-off" id="scoredetialpage">
<div class="PageWrapper mweb" id="page_wrapper" style="margin-top:44px;">
    <header class="Header">
        <!-- 头部导航条-->
        <div class="fixed_header">
            <div class="header_main">
                <button class="mweb_modal_back_button"></button>
                <div class="header_action_buttons" style="left:30px;">
                    <div class="page_title" style="padding-left:5px;">充值</div>
                </div>
            </div>
        </div>
    </header>
    <div id="body">
        <div class="title">充值金额:</div>
        <div class="moneylist">
            <div id="m5">
                <p>5元</p>
                <p>500分</p>
            </div>
            <div id="m10">
                <p>10元</p>
                <p>1000分</p>
            </div>
            <div id="m30">
                <p>30元</p>
                <p>3000分</p>
            </div>
            <div id="m50">
                <p>50元</p>
                <p>5000分</p>
            </div>
            <div id="m100">
                <p>100元</p>
                <p>10000分</p>
            </div>
            <div id="m200">
                <p>200元</p>
                <p>20000分</p>
            </div>
            <div id="m500">
                <p>500元</p>
                <p>50000分</p>
            </div>
            <div>
                其他金额
            </div>
        </div>
        <div class="paybtn" id="paybtn">
            立即支付<span></span>元
        </div>
    </div>
</div>
<script src="../js/jquery-1.11.3.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script src="../js/md5.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    var timestampone;
    var nonceStrone;
    var signatureone;
    $().ready(function(){
        $.ajax({
            type:"GET",
            url:"../GetSign.ashx?p=/html/recharge.html",
            async: true,
            success:function(data){
                timestampone=data.timestamp;
                nonceStrone=data.nonceStr;
                signatureone=data.signature;

                //appId, timeStamp, nonceStr, package, signType。
                wx.config({
                    debug: true,
                    appId: 'wx658c34793ecfd9f9',
                    timestamp:timestampone, //时间戳
                    nonceStr:nonceStrone,  //随机字符串
                    signature:signatureone,  //SHA1编码
                    jsApiList: [
                        // 所有要调用的 API 都要加到这个列表中
                        "chooseWXPay"
                    ]
                });
                wx.ready(function () {
                    // 在这里调用 API
                    $("#paybtn").click(function(){
//                        alert("时间戳:"+timestampone);
//                        alert("随机字符串:"+nonceStrone);
//                        alert("签名:"+signatureone);
//                        var data="<xml>"+
//                                    "<appid>wx658c34793ecfd9f9</appid>" +
//                                    "<mch_id>1428209702</mch_id>"+
//                                    "<nonce_str>"+nonceStrone+"</nonce_str>"+
//                                    "<sign>"+signatureone+"</sign>"+
//                                    "<body>充值测试</body>"+
//                                    "<out_trade_no>1</out_trade_no>"+
//                                    "<total_fee>10</total_fee>"+
//                                    "<spbill_create_ip>42.62.66.198</spbill_create_ip>"+
//                                    "<notify_url>http://www.tiantianqiche.cn/html/recharge.html<notify_url>"+
//                                    "<trade_type>JSAPI</trade_type>"+
//                                "</xml>";
                        var data="<xml> <appid>wx658c34793ecfd9f9</appid> <attach>支付测试</attach> <body>JSAPI支付测试</body> <mch_id>1428209702</mch_id> <detail>1</detail> <nonce_str>"+nonceStrone+"</nonce_str> <notify_url>http://wxpay.wxutil.com/pub_v2/pay/notify.v2.php</notify_url> <openid>oUpF8uMuAJO_M2pxb1Q9zNjWeS6o</openid> <out_trade_no>0000000000</out_trade_no> <spbill_create_ip>14.23.150.211</spbill_create_ip> <total_fee>1</total_fee> <trade_type>JSAPI</trade_type> <sign>0CB01533B8C1EF103065174F50BCA001</sign> </xml> ";
                        $.ajax({
                            type:"post",
                            url:"https://api.mch.weixin.qq.com/pay/unifiedorder",
//                            data:{"appid":"wx658c34793ecfd9f9","mch_id":"1428209702","nonce_str":nonceStrone,"sign":signatureone,"body":"充值测试","out_trade_no":"1","total_fee":10,"spbill_create_ip":"42.62.66.198","notify_url":"http://www.tiantianqiche.cn/html/recharge.html","trade_type":"JSAPI"},
                            data:data,
                            success:function(d){
                                alert(d)
                            },
                            error:function(d){
                                console.log(d);
                            }
                        })
//                        var paysign="appid=wx658c34793ecfd9f9&nonceStr="+nonceStrone+"&package=prepay_id=1428209702&signType="+signatureone+"&timeStamp="+timestampone+"&key=08fcd15716dfdea0098839253b361785";
//                        var paysign="appid=wx658c34793ecfd9f9&body=test&device_info=1000&mch_id=10000100&nonce_str=ibuaiVcKdpRxkhJA&total_fee=10&key=08fcd15716dfdea0098839253b361785";
//                        var sign=hex_md5(paysign).toUpperCase();
//                        alert(sign);
//                        wx.chooseWXPay({
//                            timestamp: timestampone, // 支付签名时间戳，注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
//                            nonceStr:nonceStrone, // 支付签名随机串，不长于 32 位
//                            package: 'prepay_id=wx658c34793ecfd9f9', // 统一支付接口返回的prepay_id参数值，提交格式如：prepay_id=***）
//                            signType:signatureone, // 签名方式，默认为'SHA1'，使用新版支付需传入'MD5'
//                            paySign:sign, // 支付签名
//                            success: function (res) {
//                                // 支付成功后的回调函数
//                            }
//                        });
                    });
                });
            }
        })
    });

</script>
</body>
</html>